package com.shen.thread.state;

import java.text.SimpleDateFormat;
import java.util.Date;

public class TestSleep2 {

    public static void main(String[] args) throws InterruptedException {
        Date date = new Date(System.currentTimeMillis());
        while (true) {
            Thread.sleep(1000);
            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
            System.out.println(format);
            date = new Date(System.currentTimeMillis());//更新
        }
    }


}